package com.woniuxy.company5.service.impl;

import com.woniuxy.company5.entity.RepFeedback;
import com.woniuxy.company5.mapper.RepDistributionMapper;
import com.woniuxy.company5.mapper.RepFeedbackMapper;
import com.woniuxy.company5.mapper.RepProgressMapper;
import com.woniuxy.company5.service.RepFeedbackService;
import com.woniuxy.company5.vo.RepFeedbackVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RepFeedbackServiceImpl implements RepFeedbackService {
    @Resource
    private RepFeedbackMapper repFeedbackMapper;
    @Resource
    private RepDistributionMapper repDistributionMapper;
    @Resource
    private RepProgressMapper repProgressMapper;
    @Override
    @Transactional
    public int insertSelective(RepFeedback record) {
        repDistributionMapper.updateByNum(record.getNum());
        return repFeedbackMapper.insertSelective(record);
    }

    @Override
    @Transactional
    public int add2(RepFeedback record) {
        repProgressMapper.updateByNum(Integer.parseInt(record.getNum()));
        return repFeedbackMapper.insertSelective(record);
    }

    @Override
    public int add3(RepFeedback record) {
        repProgressMapper.updateByNum2(Integer.parseInt(record.getNum()));
        return repFeedbackMapper.insertSelective(record);
    }
    @Override
    public List<RepFeedbackVo> selAllRepFeedback() {
        return repFeedbackMapper.selAllRepFeedback();
    }

    @Override
    public int updateAuditByNum(RepFeedbackVo record) {
        return repFeedbackMapper.updateAuditByNum(record);
    }

    @Override
    public int deleteByNum(String num) {
        return repFeedbackMapper.deleteByNum(num);
    }

    @Override
    public List<RepFeedbackVo> FeedbSearchByNums(String num) {
        return repFeedbackMapper.FeedbSearchByNums(num);
    }
}
